#ifndef HANDLEOBJ_H
#define HANDLEOBJ_H

#include <QWidget>
#include <QCloseEvent>
#include <QMessageBox>
#include <QEvent>
#include <QPushButton>
#include <QToolButton>
#include <QFileDialog>
#include <QDir>
#include <QMediaPlayer>
#include <QAudioOutput>
#include <QUrl>
#include <QRandomGenerator>
#include <QToolButton>
#include <QApplication>
#include <QObject>
#include <QPropertyAnimation>
#include <QMediaMetaData>
#include <QRegularExpression>
#include <QScrollBar>
#include <QListWidget>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QUrlQuery>
#include <QBuffer>
#include <QXmlStreamReader>
#include <QToolTip>

#define assetsPath "F:\\QtProjects\\MediaPlayer\\assets\\"
#define picSize 6
#define objSize 2

class HandleObj : public QWidget
{
    Q_OBJECT
public:
    explicit HandleObj(QWidget *parent = nullptr);

    bool handleButtonEvent(QPushButton *button, QEvent *event);
    void handleButtonStyle(QPushButton *button, QString pic, QObject *obj);

    bool handleSwitchEvent(QPushButton *button, QEvent *event, QString pic1, QString pic2);
    void handleSwitchStyle(QPushButton *button, QString pic, QObject *obj);

    bool handleUserButtonEvent(QPushButton *button, QEvent *event, QString style1, QString style2, QString style3);
    void handleUserButtonStyle(QPushButton *button, QString pic, QString style, QObject *obj);

    bool handleTipButtonEvent(QPushButton *button, QEvent *event, QString tip);

    void region(const QPoint &currentGlobalPoint);  //鼠标的位置,改变光标
    QString truncateString(const QString &str, int maxLength);
    bool isValidString(const QString &str);
    void listwidgetSetFont(QListWidget *list, int item_num, int font_size);
    QString generateToken(const QString &password, const QString &salt);

protected:
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    // void paintEvent(QPaintEvent *);

private:
    #define PADDING 2
    enum Direction { UP=0, DOWN=1, LEFT, RIGHT, LEFTTOP, LEFTBOTTOM, RIGHTBOTTOM, RIGHTTOP, NONE };

    QPoint m_movePoint;    //鼠标的位置
    bool isLeftPressDown;  // 判断左键是否按下
    Direction dir;         // 窗口大小改变时，记录改变方向

signals:
};

#endif // HANDLEOBJ_H
